﻿using RestSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OznerOA.Utils
{
    public class HttpRestClientHelper
    {
        public static IRestResponse HttpGetResponse(string URL,Method method,string cookies, params string[] headers)
        {
            var client = new RestClient(URL);
            var request = new RestRequest(method);
            request.AddHeader("Cookie", cookies);
            for(int i = 0; i < headers.Length; i += 2)
            {
                request.AddHeader(headers[i], headers[i + 1]);
            }
            IRestResponse response = client.Execute(request);
            return response;
        }
    }
}
